package com.ai.bitcoin.jpa.service.impl;

import com.ai.bitcoin.jpa.dao.BccReportDao;
import com.ai.bitcoin.jpa.entity.BccReport;
import com.ai.bitcoin.jpa.service.BccReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Jason
 * @date 2018.5.11
 **/
@Component
public class BccReportServiceImpl implements BccReportService {
    @Autowired
    BccReportDao dao;

    @Override
    @Transactional
    public BccReport save(BccReport bccReport) {
        return dao.save(bccReport);
    }

    @Override
    public List<BccReport> findAllByOrderByCirculationCapUsdDesc() {
        return dao.findAllByOrderByCirculationCapUsdDesc();
    }

    @Override
    public List<BccReport> findOrderByVolume24hDesc() {
        return dao.findAllByOrderByVolume24hUsdDesc();
    }

    @Override
    public List<BccReport> findByReportDateNot(String reportDate) {
        return dao.findByReportDateNot(reportDate);
    }

    @Override
    @Transactional
    public void deleteByReportDateNot(String date) {
        dao.deleteByReportDateNot(date);
    }
}
